#if !defined(AFX_HISTOGRAMSURFACE_H__11F02CCC_B8C2_4389_A1F6_CE3BE5B5DD78__INCLUDED_)
#define AFX_HISTOGRAMSURFACE_H__11F02CCC_B8C2_4389_A1F6_CE3BE5B5DD78__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HistogramSurface.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CHistogramSurface window

#include "BaseSurface.h"

typedef int (CALLBACK * HISTOGRAMMONUNITSENUMPROC)(BaseCoalMineUnit *, BaseMonitoringUnit *, const CRect& rect, LPARAM lParam);

const COLORREF kMonUnitBkColor = RGB(172, 172, 255);

class CHistogramSurface : public CBaseSurface
{
struct HistogramMonUnitRect
{
  BaseCoalMineUnit * m_pCoalMineUnit;
  BaseMonitoringUnit * m_pMonitoringUnit;
  CRect * m_pRect;
};

struct HistogramMonUnitByCursorPos
{
  BaseCoalMineUnit * m_pCoalMineUnit;
  BaseMonitoringUnit * m_pMonitoringUnit;
  CPoint * m_pPoint;
};

// Construction
public:
	CHistogramSurface(CBasePanel * pPanel);

// Attributes
protected:
  static int m_nGDIResCounter;
  static CFont * m_pMonUnitFont;

	int m_nHMax;
	int m_nVMax;
	int m_nHPos;
	int m_nVPos;

// Operations
public:
  virtual bool Create(CWnd * pParentWnd);
  virtual void Paint(CDC& dc);
  virtual void UpdateDefinitionDisplay(BaseCoalMineUnit * pCoalMineUnit);
  virtual void UpdateDataDisplay(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit);
  virtual void ApplyOptions(DWORD dwOptionPagesMask);
  virtual void HandleMouseWheel(UINT nFlags, short zDelta, CPoint pt);

protected:
  void CreateGDIResource();
  void DestroyGDIResource();
  void ResetScrollBar(const CSize& size);
  bool EnumHistogramMonUnits(HISTOGRAMMONUNITSENUMPROC lpfnEnumProc, LPARAM lParam);

  static int CALLBACK PaintMonUnits(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit, const CRect& rect, LPARAM lParam);
  static int CALLBACK GetMonitoringUnitRect(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit, const CRect& rect, LPARAM lParam);
  static int CALLBACK GetMonitoringUnitByCursorPos(BaseCoalMineUnit * pCoalMineUnit, BaseMonitoringUnit * pMonitoringUnit, const CRect& rect, LPARAM lParam);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CHistogramSurface)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CHistogramSurface();

	// Generated message map functions
protected:
	//{{AFX_MSG(CHistogramSurface)
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnHsrecordExportrecords();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_HISTOGRAMSURFACE_H__11F02CCC_B8C2_4389_A1F6_CE3BE5B5DD78__INCLUDED_)
